#include <dht.h>
//#include "bee_DHT11.h"

dht DHT;
/*
void initDHT11(int port) {
	DHT11_PIN = port;
}
*/
float last_read_time_11;
float last_read_time_21;
#define TIMEOUT 1000

float getDHT11Hum() {
	if (millis() - last_read_time_11 > TIMEOUT) {
		DHT.read11(DHT11_PIN);
		last_read_time_11 = millis();
	}
	return (float)DHT.humidity;
}

float getDHT11Temp() {
	if (millis() - last_read_time_11 > TIMEOUT) {
		DHT.read11(DHT11_PIN);
		last_read_time_11 = millis();
	}
	return (float)DHT.temperature;
}
/*
void initDHT21(int port) {
	DHT21_PIN = port;
}
*/
float getDHT21Hum() {
	if (millis() - last_read_time_21 > TIMEOUT) {
		DHT.read21(DHT21_PIN);
		last_read_time_21 = millis();
	}
	return (float)DHT.humidity;
}

float getDHT21Temp() {
	if (millis() - last_read_time_21 > TIMEOUT) {
		DHT.read21(DHT21_PIN);
		last_read_time_21 = millis();
	}
	return (float)DHT.temperature;
}
